home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 1996-02-15 | 87.7 KB | 2,380 lines | [ TEXT/R*ch]
C.S.M.P. Digest Thu, 15 Feb 96 Volume 3 : Issue 136 Today's Topics: ATM Interface? Controls in GWorlds not drawing properly? Format 'drag' resource wanted How to walk the driver table? OpenDoc and C (not ++) PICT output from CGrafPort (plea for help) Pascal or C++? PixMap pmVersion field TextEdit: how to stay in one line? TransSkel 3.24 is available (CW 8 support added) WorldScript, UniCode & Cross-Platform ? [Ann] The alt.sources.mac WWW Archive [src] Grant's CGI Framework beta 13 (mac C source) calculating height of a text box The Comp.Sys.Mac.Programmer Digest is moderated by Francois Pottier (pottier@clipper.ens.fr). The digest is a collection of article threads from the internet newsgroups comp.sys.mac.programmer.help, csmp.tools, csmp.misc and csmp.games. It is designed for people who read news semi-regularly and want an archive of the discussions. If you don't know what a newsgroup is, you probably don't have access to it. Ask your systems administrator(s) for details. If you don't have access to news, you may still be able to post messages to the group by using a mail server like anon.penet.fi (mail help@anon.penet.fi for more information). Each issue of the digest contains one or more sets of articles (called threads), with each set corresponding to a 'discussion' of a particular subject. The articles are not edited; all articles included in this digest are in their original posted form (as received by our news server at nef.ens.fr). Article threads are not added to the digest until the last article added to the thread is at least two weeks old (this is to ensure that the thread is dead before adding it to the digest). Article threads that consist of only one message are generally not included in the digest. The digest is officially distributed by two means, by email and ftp. If you want to receive the digest by mail, send email to listserv@ens.fr with no subject and one of the following commands as body: help Sends you a summary of commands subscribe csmp-digest Your Name Adds you to the mailing list signoff csmp-digest Removes you from the list Once you have subscribed, you will automatically receive each new issue as it is created. The official ftp info is ftp://ftp.dartmouth.edu/pub/csmp-digest. Questions related to the ftp site should be directed to scott.silver@dartmouth.edu. ------------------------------------------------------- >From chance59@wavenet.com (R. T. Chancellor) Subject: ATM Interface? Date: Sat, 27 Jan 1996 19:08:33 -0700 Organization: ATMnet, LLC San Diego, CA Does anyone know if a library and interface files is available for Adobe Type Manager? I used a library and .h file several years ago, but when I went looking for a newer version, all I could find was a .h file and no library. I have already tried Adobe (like pulling teeth). If you know where I can obtain it, please let me know. Thanks in advance. Robert Chancellor chance59@wavenet.com +++++++++++++++++++++++++++ >From mouser@zercom.net (Martin-Gilles Lavoie) Date: Mon, 29 Jan 1996 09:32:01 -0500 Organization: Groupimage, inc. In article <chance59-2701961908330001@la-dial1-20.wavenet.com>, chance59@wavenet.com (R. T. Chancellor) wrote: > Does anyone know if a library and interface files is available for Adobe > Type Manager? I used a library and .h file several years ago, but when I > went looking for a newer version, all I could find was a .h file and no > library. I have already tried Adobe (like pulling teeth). If you know > where I can obtain it, please let me know. > > Thanks in advance. > I have a copy for 68K code. As far as I know, no one has publicaly published a PPC native version yet. It dates back a little, but works fine. Here's where you can find it: <ftp://ftp.mv.us.adobe.com/pub/adobe/Programs/MacATM30headers.sea.hqx> For current documentation of the ATM Macintosh C interface download: <ftp://ftp.mv.us.adobe.com/pub/adobe/DeveloperSupport/TechNotes/5072.ATM_Adv_Mac.pdf> Have fun. MGL +++++++++++++++++++++++++++ >From dpolasch@apple.com (Dave Polaschek) Date: Wed, 31 Jan 1996 23:10:01 GMT Organization: Apple Computer, Inc In article <chance59-2701961908330001@la-dial1-20.wavenet.com>, chance59@wavenet.com (R. T. Chancellor) wrote: >Does anyone know if a library and interface files is available for Adobe >Type Manager? I used a library and .h file several years ago, but when I >went looking for a newer version, all I could find was a .h file and no >library. I have already tried Adobe (like pulling teeth). If you know >where I can obtain it, please let me know. It's documented in Adobe Tech Note #5072, which should be available at or near <ftp://ftp.adobe.com/pub/adobe/DeveloperSupport/TechNotes/PSfiles/> -DaveP -- "Mr. Tick, can you destroy the Earth?" "Egads! I hope not! That's where I keep all my stuff!" Dave Polaschek - home:davep@eworld.com work:dpolasch@apple.com --------------------------- >From jeffwest@204.137.144.227 (jeffwest) Subject: Controls in GWorlds not drawing properly? Date: 28 Jan 1996 19:47:04 GMT Organization: zNET I am using an offscreen GWorld to do my window updates in before I copybit it into the actual window. I am experiencing a very strange side-effect when using certain controls in the window. I set the Control's cntrlOwner field to my offscreen GWorld and use Draw1Control to draw the control. This works fine for any control that uses a CDEF without any variants, i.e. a standard push-button. However, if the control uses a variant of a CDEF then the control always draws using the CDEF without the variant. Example: I create a chechbox using a procdef of 1. I set it's cntrlOwner field to my offscreen GWorld and call Draw1Control and then copybit it over to the window and it appears as a standard push-button. I then click on it and it redraws itself as a checkbox. I tried this with a custom CDEF I had the source code for and found out through the debugger that the CDEF would always get passed a variant of 0 when it is being drawn in an offScreen port. I beleive this might have something to do with the fact that a GWorld does not have a control list hanging off of it like a window does. (MacsBug shows that Draw1Control call a couple of other ControlManager routines, including GetCntlVariant before it actually draws the control. Does anyone know of a fix / work around for this problem? Am I doing something wrong? Any help would be greatly appreciated. Thanks, Jeff West +++++++++++++++++++++++++++ >From dflatin@magnus.acs.ohio-state.edu (Dan Flatin) Date: Mon, 29 Jan 1996 12:45:20 -0600 Organization: Department of Physics, The Ohio State University You might try drawing the controls directly to the window, and mask out their rects when you do the CopyBits. That has worked for me. -- Dan Flatin Department of Physics The Ohio State Unviersity +++++++++++++++++++++++++++ >From jeffwest@204.137.144.227 (jeffwest) Date: 1 Feb 1996 02:03:06 GMT Organization: zNET In article <dflatin-2901961245200001@slip1-26.acs.ohio-state.edu> dflatin@magnus.acs.ohio-state.edu (Dan Flatin) writes: > You might try drawing the controls directly to the window, and mask out > their rects when you do the CopyBits. That has worked for me. Thanks, but I looked at the source for PowerPlant to see if and how they were handling this and discovered a great workaround. Their solution is to leave the control's owner alone and, in the middle of drawing to your offscreen port, switch the port to the control's window, open a picture, draw the control, close the picture, switch the port back to the offscreen port and then draw the picture of the control in place of the control. It works great! I plan on checking out the rest of the PowerPlant code to see what other neat tricks they have up their sleeve. Thanks for your response. Regards, Jeff West Logical Inventions --------------------------- >From jbruyndonckx@waveresearch.com (Jan Bruyndonckx) Subject: Format 'drag' resource wanted Date: Tue, 23 Jan 1996 09:14:42 +0100 Organization: Cratylus Corp Hi, I'm looking for the full description of the 'drag' resource. This resource is used by the drag & drop manager in clippings files. I know the meaning of some fields, but I'd like to know the meaning of each field. Has anyone figured it out? Thanks, Jan Bruyndonckx Wave Research \|/ (o o) ________________________________oOo__(_)__oOo_________________________________ | Jan Bruyndonckx And what is good, Phaedrus, And what is not good, | | Need we ask anyone to tell us these things | | e-mail: jbruyndonckx@waveresearch.com (R. Pirsig) | l____________________________________________________________________________l +++++++++++++++++++++++++++ >From ldo@waikato.ac.nz (Lawrence D'Oliveiro) Date: Mon, 29 Jan 1996 13:38:10 +1300 Organization: University of Waikato In article <jbruyndonckx-2301960914430001@194.7.68.21>, jbruyndonckx@waveresearch.com (Jan Bruyndonckx) wrote: >I'm looking for the full description of the 'drag' resource. >This resource is used by the drag & drop manager in clippings files. >I know the meaning of some fields, but I'd like to know the meaning of >each field. It seems pretty simple. The initial part looks like this: TYPE DragResourceHeader = RECORD VersionNumber : LongCard; (* = 1 *) Unused1, Unused2 : LongCard; (* always 0 *) NrFlavors : LongCard; (* Flavor : ARRAY [1 .. NrFlavors] OF DragResourceEntry *) END (*RECORD*); where NrFlavors is the number of flavour entries. This is immediately followed by that number of entries, of the following format: TYPE DragResourceEntry = RECORD FlavorType : OSType; ResourceID : LongInt; Unused1, Unused2 : LongCard; (* always 0 *) END (*RECORD*); FlavorType is the flavour type as well as the type of the resource containing the flavour data. ResourceID is the ID of the resource. All the clipping files I've seen use 128 as the ID for all resources, and I've successfully done the same in clipping files created by my ClipStation utility. Clipping files have four different file types: "clpp" for picture clippings, "clpt" for text clippings, "clps" for sound clippings, and "clpu" for everything else. --------------------------- >From alex <netman@kudonet.com> Subject: How to walk the driver table? Date: Fri, 26 Jan 1996 14:04:58 -0800 Organization: NASA Ames Research Center I'm a relatively new Mac programmer trying to write an installer and can't figure out how to walk the driver table to search for previously installed components. Can someone help me out? thanks in advance, alex netman@kudonet.com +++++++++++++++++++++++++++ >From <williamt@aloha.com> Date: 28 Jan 1996 19:15:57 GMT Organization: FlexNet Inc, HAWAII alex <netman@kudonet.com> wrote: >I'm a relatively new Mac programmer trying to write an installer >and can't figure out how to walk the driver table to search for >previously installed components. Can someone help me out? >thanks in advance, >alex >netman@kudonet.com I'm sure this started as Apple example code some time back. E-mail me if it doesn't make sense: short GetUnusedDrvrRefNum (void) { AuxDCEPtr *unitTable; short unitEntryCount; short unitNumber; short drvrRefNum = 0; /* default to no entry found */ unitTable = (AuxDCEPtr *)GetUnitTableBase(); unitEntryCount = GetUnitEntryCount(); /* Look for the first empty entry */ unitNumber = kMinUnitNum; while (unitNumber < unitEntryCount) { if (unitTable[unitNumber] == nil) { /* Find an empty entry? */ /* Yes, then calculate its driver reference number */ drvrRefNum = -1 * (unitNumber +1); break; } else ++unitNumber; } return (drvrRefNum); } --------------------------- >From jhuber@optik.eng.yale.edu (John Huber) Subject: OpenDoc and C (not ++) Date: Mon, 29 Jan 1996 16:57:02 -0500 Organization: Yale University, Dept of EE I've got a silly question... I dabble in C programming (even wrote a couple of little applications with all that interface stuff:), however, I've never done C++ (though I did flip through a Primer once). Anyway, is OpenDoc accessible via C, or does one have to bite the bullet and learn C++ (it's a time issue for me). Thanks, John +++++++++++++++++++++++++++ >From jeremy@dewey.soe.berkeley.edu (Jeremy Roschelle) Date: 31 Jan 1996 16:08:02 GMT Organization: SimCalc In article <jhuber-2901961657020001@hood.eng.yale.edu>, jhuber@optik.eng.yale.edu (John Huber) wrote: >I've got a silly question... > >I dabble in C programming (even wrote a couple of little applications with >all that interface stuff:), however, I've never done C++ (though I did >flip through a Primer once). Anyway, is OpenDoc accessible via C, or does >one have to bite the bullet and learn C++ (it's a time issue for me). It is accesible in C, and there is even a sample part in C I think. jeremy jeremy > > > > > > > > > > * Jeremy Roschelle * SimCalc Project * 4104 24th Street #344 * San Francisco CA 94114 * 415 695.2801 +++++++++++++++++++++++++++ >From jeremy@dewey.soe.berkeley.edu (Jeremy Roschelle) Date: 31 Jan 1996 16:10:10 GMT Organization: SimCalc In article <jhuber-2901961657020001@hood.eng.yale.edu>, jhuber@optik.eng.yale.edu (John Huber) wrote: >I've got a silly question... > >I dabble in C programming (even wrote a couple of little applications with >all that interface stuff:), however, I've never done C++ (though I did >flip through a Primer once). Anyway, is OpenDoc accessible via C, or does >one have to bite the bullet and learn C++ (it's a time issue for me). It is accesible in C, and there is even a sample part in C I think. jeremy jeremy > > > > > > > > > > * Jeremy Roschelle * SimCalc Project * 4104 24th Street #344 * San Francisco CA 94114 * 415 695.2801 +++++++++++++++++++++++++++ >From jayfar@netaxs.com (Jay Farrell) Date: Wed, 31 Jan 1996 13:12:29 -0500 Organization: Jayfar's Web In article <4eo492$j7o@slip.net>, jeremy@dewey.soe.berkeley.edu (Jeremy Roschelle) wrote: | In article <jhuber-2901961657020001@hood.eng.yale.edu>, | jhuber@optik.eng.yale.edu (John Huber) wrote: | | >I've got a silly question... | > | >I dabble in C programming (even wrote a couple of little applications with | >all that interface stuff:), however, I've never done C++ (though I did | >flip through a Primer once). Anyway, is OpenDoc accessible via C, or does | >one have to bite the bullet and learn C++ (it's a time issue for me). | | It is accesible in C, and there is even a sample part in C I think. Which reminds me of an earlier question I asked the response to which was not very encouraging. What about the various public domain languages that some of us choose to dabble in? The book (just out from Apple; forgot the exact title) claims you can do OpenDoc in *any* language, thanks to IDL. How? Could somebody point me to where in the voluminous docs I can puzzle this out? TIA, Jayfar ////~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//// //// The Mops Page <URL:http://www.netaxs.com/~jayfar/mops.html> //// ////~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//// //// Mops is Mike Hore's freeware Forth/Smalltalk hybrid for Macintosh //// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Jay Farrell jayfar@netaxs.com Philadelphia, Pennsylvania, USA +++++++++++++++++++++++++++ >From neeri@iis.ee.ethz.ch (Matthias Neeracher) Date: 01 Feb 1996 17:07:19 GMT Organization: Integrated Systems Laboratory, ETH, Zurich In article <jayfar-3101961312290001@downtown1-33.slip.netaxs.com>, jayfar@netaxs.com (Jay Farrell) writes: > In article <4eo492$j7o@slip.net>, jeremy@dewey.soe.berkeley.edu (Jeremy > Roschelle) wrote: > | In article <jhuber-2901961657020001@hood.eng.yale.edu>, > | jhuber@optik.eng.yale.edu (John Huber) wrote: > | > | >I've got a silly question... > | > > | >I dabble in C programming (even wrote a couple of little applications with > | >all that interface stuff:), however, I've never done C++ (though I did > | >flip through a Primer once). Anyway, is OpenDoc accessible via C, or does > | >one have to bite the bullet and learn C++ (it's a time issue for me). > | > | It is accesible in C, and there is even a sample part in C I think. > Which reminds me of an earlier question I asked the response to which was > not very encouraging. What about the various public domain languages that > some of us choose to dabble in? The book (just out from Apple; forgot the > exact title) claims you can do OpenDoc in *any* language, thanks to IDL. > How? Could somebody point me to where in the voluminous docs I can puzzle > this out? To do OpenDoc, you have to be able to do SOM. SOM is remarkably language neutral, however, the current Mac implementation lacks some key components to deliver on that promise: - For static languages (like Pascal), the SOM compiler lacks the ability to hook into the Emitter framework. On other platforms, apparently you can write your own backend to the IDL compiler to make it generate stubs in whatever language you want to use. - For dynamic languages (Perl, Tcl, Scheme, Frontier, Mops?), the support for reflexiveness is not yet complete enough. In principle, SOM has mechanisms to find out all type information at runtime, but I understand these have not yet been implemented on the Mac. So the key problems seem to be in the area of SOM, and Apple seems not to be overly motivated to remedy them. Matthias - --- Matthias Neeracher <neeri@iis.ee.ethz.ch> http://err.ethz.ch/members/neeri.html "Have you heard of the new Cambridge compilers ? They distribute gear-wear much more evenly" -- William Gibson/Bruce Sterling, _The Difference Engine_ --------------------------- >From subtle@progsoc.uts.edu.au (Paul Mclachlan) Subject: PICT output from CGrafPort (plea for help) Date: Mon, 22 Jan 1996 17:14:31 +1000 Organization: Microplex Pty Ltd I've recently started programming on the macintosh environment with Codewarrior, and have, I'm afraid, run into a small wall. I can read in a PICT file and display it, however I'm having a lot of trouble then when trying to write it back out to disk again. I've read almost all of the ColorQuickdraw section of Inside Macintosh, but something is eluding me. At the moment, I can output a perfectly good PICT file, provided I don't want any images in it. That is, I can move the cursor and draw lines, and output *that* to a PICT file, but when I try to use CopyBits(), for some strange reason, it fails to work. Perhaps I'm being a bit too fancy. What I'm actually trying to do is store whats currently displayed on the screen (its built up of layered images - to write them over one another would use more disk space than required?), so I attempt to use CopyBits to basically copy the PixMap onto itself. Now... it says in the manual that if I want to copybits like that I should change to Global co-ordinates, and I've tried that - I've also experiemented with a variety of regions. Whats got me stumped is that when I read in the PICT originally, I can just hold onto that handle that I've got, and write it back out perfectly - if I try to use OpenCPicture to record it again - well... I'm obviously doing something wrong. If anyone has written something like this, or has some code that does something similar that I could take a look at, I'd greatly appreciate it. Failing that, if someone could just yell 'You're doing it wrong!' and push me in the right direction... ;p~ Thanks, Paul - - Paul Mclachlan paulm@access.com.au #include <stddisclaimer.h> +++++++++++++++++++++++++++ >From Carl R. Osterwald <carl_osterwald@nrel.gov> Date: 25 Jan 1996 17:32:40 GMT Organization: National Renewable Energy Laboratory In article <subtle-2201961714420001@203.18.229.38> Paul Mclachlan, subtle@progsoc.uts.edu.au writes: >At the moment, I can output a perfectly good PICT file, provided I don't >want any images in it. That is, I can move the cursor and draw lines, and >output *that* to a PICT file, but when I try to use CopyBits(), for some >strange reason, it fails to work. One thing that can cause this is lack of enough memory. When recording a picture with OpenPicture() / ClosePicture(), it can be difficult to determine if any errors occured. You can try looking at the size of the PicHandle to see if it is greater than 10 bytes, and if the picFrame is equal to the rectangle used when creating the PICT. I have found that these will not be true if the picture creation failed. +++++++++++++++++++++++++++ >From Binky the Wonderwhorse <binky@mmcorp.com> Date: 29 Jan 1996 17:35:13 GMT Organization: MultiMedia Corporation lo, try something like this (this routine is taken from something I did last year...it works as is) there might be the odd call or two that might not work cuz the project had over 200 files in it and I really can't be bothered to go hacking around for the sources...sorry, but theres enough here to get you going. Hope this helps. Binky // ============================================================= // = PicHandleToPICTfile = // ============================================================= // = You give me a PicHandle, a filename and a volume to = // = it on and I'll do the donkey work. Its a simple = // = routine but then so is waking up...so why is waking up = // = so damned difficult? The easiest things are the = // = hardest - least thats what I think = // ============================================================= #define kNearAsDammitEmptyHandleSize 4 #define kPictCreatorType '????' #define kPictureType 'PICT' Boolean PicHandleToPICTfile(const PicHandle thePichandle, const Str255 theFilename, const short volumeRefNum) { Boolean result = FALSE; OSErr iErr = noErr; short myFileRef = 0, myResFile = 0,saveRes; char pictHeader[512]; long byteCount = kPICTHeaderSize; FSSpec myFSSpec; PicHandle theThumbnail = (PicHandle)NewHandle(kNearAsDammitEmptyHandleSize); //handle will be resized saveRes = CurResFile(); if (!thePichandle) goto bail; //PicHandle was NULL so we have nothing to write HLock((Handle)thePichandle); iErr = ::Create(theFilename, volumeRefNum, kPictCreatorType, kPictureType); //create the empty file if (iErr) goto bail; iErr = ::FSOpen(theFilename, volumeRefNum, &myFileRef); //open the file (data fork only, NOT resource fork...do that bit later) if (iErr) { myFileRef = 0; //set to zero cuz bail routine might try to close the file...even if unopened goto bail; } iErr = ::FSWrite(myFileRef, &byteCount, &pictHeader); //write the 512 byte header if (iErr) goto bail; byteCount = ::GetHandleSize((Handle)thePichandle); //write the PICT in data fork iErr = ::FSWrite(myFileRef, &byteCount, *thePichandle); if (iErr) goto bail; iErr = ::FSClose(myFileRef); //close the file myFileRef = 0; //set to zero to prevent accidentally closing it twice...WHICH IS BAD NOOZ! if (iErr) goto bail; iErr = ::FSMakeFSSpec(volumeRefNum, 0, theFilename, &myFSSpec); //create an FSSpec record if (iErr) goto bail; ::FSpCreateResFile(&myFSSpec, kPictCreatorType, kPictureType, NULL); //no error code returned if (::ResError()) //so we get it from ResError() goto bail; myResFile = ::FSpOpenResFile(&myFSSpec, fsRdWrPerm); //open the resource file with exclusive read/write permission if (ResError()) { myResFile = 0; //set to zero cuz bail routine might try to close the ResFile, even if unopened, unless fileref is zero goto bail; } UseResFile(myResFile); //tell MacOS that we want to use this resource file if (::ResError()) //check for any errors goto bail; iErr = MakeThumbnailFromPicture(thePichandle, 32, theThumbnail, NULL); //create the preview PICT if (iErr) goto bail; iErr = AddFilePreview(myResFile, kPictureType, (Handle)theThumbnail); //add the preview picture if (iErr) goto bail; theThumbnail = NULL; // prevent our bail routine from deallocating this because it is now owned by the Resource Manager //I won't bother checking for errors here CloseResFile(myResFile); // closeing the res file also updates it myResFile = 0; // YOU MUST DO THIS OTHERWISE THE bail ROUTINE WILL TRY TO CLOSE IT AGAIN AND THAT WILL *CRASH* result = TRUE; //yay, all went well bail: if (thePichandle) HUnlock((Handle)thePichandle); if (myResFile) CloseResFile(myResFile); //I won't bother checking for errors if (myFileRef) iErr = FSClose(myFileRef); //I'll ignore any error returned here if (theThumbnail) DisposHandle((Handle)theThumbnail); UseResFile(saveRes); return result; } +++++++++++++++++++++++++++ >From Binky the Wonderwhorse <binky@mmcorp.com> Date: 29 Jan 1996 18:01:11 GMT Organization: MultiMedia Corporation lo, I forgot...silly me, I totally forgot what you were asking. It seems I didn't fully answer your question. Right, now what I think you're trying to do is take an image of whats in a window, store it as a PICT and then save it out to a file. I already posted the code for saving a PicHandle to a file so heres the code for grabbing whats in a window into a PicHandle. PicHandle WindowToPicHandle(WindowPtr theWindow) { CGrafPtr savePort; GDHandle saveDevice; PicHandle thePic = NULL; GetGWorld(&savePort, &saveDevice); SetGWorld((CGrafPtr)theWindow, GetMainDevice()); ForeColor(blackColor); BackColor(whiteColor); ClipRect(&theWindow -> portRect); thePic = OpenPicture(&theWindow -> portRect); CopyBits(&theWindow -> portBits, &theWindow -> portBits, &theWindow -> portRect, &theWindow -> portRect, srcCopy, NULL); ClosePicture(); SetGWorld(savePort, saveDevice); } So, you call this routine and it returns you the PicHandle. You then pass this to the other routine to dump the pic to disk. To get the pic size just use GetHandleSize((Handle)thePic); Hope this is what you were after. If not then mail me and I'll do you a nice spangly app with source code! (in penance for being stoopid) Binky --------------------------- >From dallas@az.com (Brad & Angie) Subject: Pascal or C++? Date: 31 Dec 1995 03:27:31 GMT Organization: 49N Volleyball Pascal or C++? So what is the answer? I am starting a new programming class at the high school level this January and don't have a compiler yet. We also don't have much money! Does anyone out there teach computer programming? I will be working on Macintosh platforms ranging from the LCII to some PowerPC 5200 and 6200 series. I have looked at Symantec Pascal 4.0, but this does not support PowerPC code. I have Symantec C 6.0 at home, but again no support for PPC. I am most familiar with the Symantec package, but this is not a major consideration. I have read the advertising for MetroWorks CodeWarrior 7.0 which supports both C and Pascal, but this costs big bucks. What do you use? Any help would be greatly appreciated! Brad. -- Brad & Angie Dallas dallas@az.com +++++++++++++++++++++++++++ >From daniel@cs.colostate.edu (John Daniel) Date: Sun, 31 Dec 1995 08:46:19 -0700 Organization: Colorado State University Brad & Angie, You're a student so Codewarrior Academic will only cost you $99. It will be the best $99 you've ever spent. Go for it. It has all the features CW Gold has only you can't sell shrink-wrapped programs with it, only shareware. Order Now! John Daniel -- "Just because you're paranoid doesn't mean they aren't out to get you" +++++++++++++++++++++++++++ >From neeri@iis.ee.ethz.ch (Matthias Neeracher) Date: 31 Dec 1995 12:50:10 GMT Organization: Integrated Systems Laboratory, ETH, Zurich [Followups redirected to comp.sys.mac.programmer.help] In article <dallas-3012950728570001@ppp31.atlantica.net>, dallas@az.com (Brad & Angie) writes: > Pascal or C++? > So what is the answer? > I am starting a new programming class at the high school level this > January and don't have a compiler yet. For teaching purposes, Pascal is IMHO much better than C++ (Given that for actual programming, I prefer C++, I don't think anybody can accuse me of bias). > We also don't have much money! Does anyone out there teach computer > programming? I will be working on Macintosh platforms ranging from the LCII > to some PowerPC 5200 and 6200 series. I have looked at Symantec Pascal 4.0, > but this does not support PowerPC code. I have Symantec C 6.0 at home, but > again no support for PPC. I am most familiar with the Symantec package, but > this is not a major consideration. I have read the advertising for MetroWorks > CodeWarrior 7.0 which supports both C and Pascal, but this costs big bucks. CodeWarrior for academic purposes officially costs $99, but I've heard of even lower prices. If that's still too much money for you, you might want to consider teching Scheme instead, using the free Gambit Scheme. If Scheme is good enough for MIT, it might be good enough for you :-) Matthias - --- Matthias Neeracher <neeri@iis.ee.ethz.ch> http://err.ethz.ch/members/neeri.html "Of course the government and the newspapers lie. But in a democracy they're not the *same* lies!" - GURPS Illuminati +++++++++++++++++++++++++++ >From jj10s@eworld.com (J. Voigt) Date: Sun, 31 Dec 1995 13:18:59 -0600 Organization: (ml) In article <dallas-3012950728570001@ppp31.atlantica.net>, dallas@az.com (Brad & Angie) wrote: > Pascal or C++? > So what is the answer? > I am starting a new programming class at the high school level this > January and don't have a compiler yet. We also don't have much money! C++ at the highschool level! Yikes! > I have looked at Symantec Pascal 4.0, but this does not support > PowerPC code. I have Symantec C 6.0 at home, but again no support for PPC. Why does this matter? > I have read the advertising for MetroWorks CodeWarrior 7.0 > which supports both C and Pascal, but this costs big bucks. The Academic version is $99. I don't see any reason to have students grapple with the complex arcana of low-level languages (Assembly or C) or professional programming languages (C++)--esp. at the highschool level, if the intent is to teach the basic concepts of comp.sci. For entry level programming, I'd recommend one of the following: Logo, Basic, or HyperCard. There are many good introductory programming books for Logo and Basic. If you want to get a bit more sophisticated: Pascal, Scheme, Mathematica (which offers a very nice dynamic language and powerful symbolic calculation features). One can of course find many excellent intro.to.prog w/Pascal books. For Scheme, you might try Friedman & Felleisen's "The Little Lisper" (or the second ed., The Little Schemer, coming soon). For Mathematica my personal favorite is Wagon's "Mathematica in Action". Dewdney's "The New Turing Omnibus" makes for an excellent general comp.sci text, and is perfect for teaching at the highschool level. Good luck. j ~ -- J. Voigt / just some guy / not affiliated with anyone or anything (MediaLink@mail-newrock.coretech.com) +++++++++++++++++++++++++++ >From mwron@aol.com (MW Ron) Date: 31 Dec 1995 14:52:20 -0500 Organization: America Online, Inc. (1-800-827-6364) dallas@az.com (Brad & Angie) Writes: >Pascal or C++? >So what is the answer? >I am starting a new programming class at the high school level this >January and don't have a compiler yet. We also don't have much money! Does >anyone out there teach computer programming? I will be working on >Macintosh platforms ranging from the LCII to some PowerPC 5200 and 6200 >series. I have looked at Symantec Pascal 4.0, but this does not support >PowerPC code. I have Symantec C 6.0 at home, but again no support for PPC. >I am most familiar with the Symantec package, but this is not a major >consideration. I have read the advertising for MetroWorks CodeWarrior 7.0 >which supports both C and Pascal, but this costs big bucks. >What do you use? >Any help would be greatly appreciated! If you are a student or a teacher you are eligible for the Academic Gold Version of Metrowerks CodeWarrior. It is just $99, and includes everything the Gold Professional model includes. We also have a version Programmer Starter Kit for just $79. ( Soon to be replaced with a Discover Programming CD series by Metrowerks and Dave Mark) While this CD only creates 68k Applications the compilers are FAT and will run as native on either PowerPC or 68k and of course the programs they develop will run on either CPU. This includes all the Metrowerks Tools that are included in the Bronze version but it is not a subscription. Feel Free to write to me for more infomration. Ron METROWERKS Ron Liechty "Software at Work" MWRon@metrowerks.com +++++++++++++++++++++++++++ >From k12baimv@vaxa.hofstra.edu (Vijay Iyer) Date: 31 Dec 95 17:31:02 EST Organization: Hofstra University In article <jj10s-3112951318590001@port07.cornet.com>, jj10s@eworld.com (J. Voigt) writes: > In article <dallas-3012950728570001@ppp31.atlantica.net>, dallas@az.com > (Brad & Angie) wrote: > >> Pascal or C++? >> So what is the answer? >> I am starting a new programming class at the high school level this >> January and don't have a compiler yet. We also don't have much money! > > C++ at the highschool level! Yikes! > I don't see any reason to have students grapple with the complex arcana of > low-level languages (Assembly or C) or professional programming languages > (C++)--esp. at the highschool level, if the intent is to teach the basic > concepts of comp.sci. > > For entry level programming, I'd recommend one of the following: > Logo, Basic, or HyperCard. > > There are many good introductory programming books for Logo and Basic. > > If you want to get a bit more sophisticated: > Pascal, Scheme, Mathematica (which offers a very nice dynamic language and > powerful symbolic calculation features). > (MediaLink@mail-newrock.coretech.com) Being a high school student, I feel that learning C++ is a better choice for a slightly higher-level course in a high school. I am presently learning Pascal in school and C++ at home, and I feel that C++ is more elegant and not harder to learn than Pascal. I also believe that the Advanced Placement exam in computer science is shifting from Pascal to either C or C++ within the next two years, which may or may not be an important consideration. At present, most of our CS class is rebelling as we seem to universally hate the Pascal in favor of C :-) -- Copyright 1995 Vijay Iyer (k12baimv@hofstra.edu). All rights reserved. All views represented reflect those of my employer. http://www.cyberspace.org/u/viyer/www/homepage.html +++++++++++++++++++++++++++ >From troy@oz.net (Troy Davis) Date: Mon, 01 Jan 1996 02:46:26 GMT Organization: oz.net - http://www.oz.net jj10s@eworld.com (J. Voigt) said: >I don't see any reason to have students grapple with the complex arcana of >low-level languages (Assembly or C) or professional programming languages >(C++)--esp. at the highschool level, if the intent is to teach the basic >concepts of comp.sci. >For entry level programming, I'd recommend one of the following: >Logo, Basic, or HyperCard. Are you kidding? I remember we did Logo on Apple ][E's in 4th grade, and HyperCard (barely a language) in 6th grade. I did Basic (and it is worthwhile.... some say it teaches bad habits but I don't think so...) in 6th grade. I'm 14 and starting to learn C. High school is definately not too early. -=| Troy Davis |=- troy@oz.net - TroyDavis@aol.com http://users.aol.com/TroyDavis/ Seattle, WA, USA +++++++++++++++++++++++++++ >From t-shinbrot@nwu.edu (Troy Shinbrot) Date: Sun, 31 Dec 1995 23:04:53 -0500 Organization: Northwestern University In article <dallas-3012950728570001@ppp31.atlantica.net>, dallas@az.com (Brad & Angie) wrote: > Pascal or C++? > So what is the answer? > I am starting a new programming class at the high school level this > January and don't have a compiler yet. We also don't have much money! Does > anyone out there teach computer programming? I will be working on > Macintosh platforms ranging from the LCII to some PowerPC 5200 and 6200 > series. I have looked at Symantec Pascal 4.0, but this does not support > PowerPC code. I have Symantec C 6.0 at home, but again no support for PPC. > I am most familiar with the Symantec package, but this is not a major > consideration. I have read the advertising for MetroWorks CodeWarrior 7.0 > which supports both C and Pascal, but this costs big bucks. > What do you use? > Any help would be greatly appreciated! > Brad. There is no way you would catch me trying to teach C, with or without ++, as an introductory language. It's just too dangerous (in that nothing prevents the learning programmer from writing the wrong size data into the wrong place, for instance), it's too hard (students can't do a thing until they understand the what a pointer is, for example), and the learning-to-aggravation ratio is too low. Moreover, once a student learns how basic programming in a relatively simple and painless environment like Pascal, it's trivial to turn to C and substitute '{' for 'begin' and so forth. -Troy +++++++++++++++++++++++++++ >From stevec@accessone.com (Steven Carlson) Date: Mon, 01 Jan 1996 08:53:41 -0800 Organization: :-) In article <dallas-3012950728570001@ppp31.atlantica.net>, dallas@az.com (Brad & Angie) wrote: ^Pascal or C++? ^So what is the answer? ^I am starting a new programming class at the high school level this ^January and don't have a compiler yet. We also don't have much money! Does ^anyone out there teach computer programming? I will be working on ^Macintosh platforms ranging from the LCII to some PowerPC 5200 and 6200 ^series. I have looked at Symantec Pascal 4.0, but this does not support ^PowerPC code. I have Symantec C 6.0 at home, but again no support for PPC. ^I am most familiar with the Symantec package, but this is not a major ^consideration. I have read the advertising for MetroWorks CodeWarrior 7.0 ^which supports both C and Pascal, but this costs big bucks. ^What do you use? ^Any help would be greatly appreciated! ^Brad. ^ ^-- ^Brad & Angie Dallas ^dallas@az.com I use MW codewarrior C. In my opinion you should probably teach C and not C++. Pascal, although the syntax isn't as rigid, isn't used as much any more and chances are if you were going to do a lot of programming with other people you would have to do it in C. There is also more C source. As far as money goes, I think MW has a significant academic discount for their Academic CodeWarrior. like $99 or something. -Steven Carlson stevec@accessone.com +++++++++++++++++++++++++++ >From jj10s@eworld.com (J. Voigt) Date: Mon, 01 Jan 1996 14:34:11 -0600 Organization: (ml) [Responding to <troy@oz.net> recent re to my "Re: Pascal or C++" post] Troy, I appreciate your response to my post. I said: > >I don't see any reason to have students grapple with the complex arcana of > >low-level languages (Assembly or C) or professional programming languages > >(C++)--esp. at the highschool level, if the intent is to teach the basic > >concepts of comp.sci. > >For entry level programming, I'd recommend one of the following: > >Logo, Basic, or HyperCard. Then I said (which you had omitted in your response): > > If you want to get a bit more sophisticated: > > Pascal, Scheme, Mathematica (which offers a very nice dynamic language and > > powerful symbolic calculation features). You said: > Are you kidding? I remember we did Logo on Apple ][E's in 4th grade, > and HyperCard (barely a language) in 6th grade. I did Basic (and it is > worthwhile.... some say it teaches bad habits but I don't think so...) > in 6th grade. > > I'm 14 and starting to learn C. High school is definately not too > early. Hey, its great that you got your hands dirty when you were young. I suspect, however, that premature exposure to certain programming languages has the effect of tainting one's view of them in hindsight. Esp. if one is introduced to languages in the classroom and not of one's own volition. Logo is a powerful Lisp-derivative. A lot of kids are only introduced to the most elementary features of Logo, like turtle-graphics, and get the impression that it is simply a "toy" language. Not true; it is a very elegant and flexible language, and probably an excellent intro to Lisp-style programming. Similar statements can be made about Hypercard. It's message passing system (and in fact the whole language architecture) is an ideal intro to object-oriented programming. High school may not be "too early" to learn C for kids with a previous exposure to programming languages. However, for an intro to programming I would still claim that the above mentioned alternatives are far, far better. And for more advanced students, like yourself, a much better alternative is Scheme (or some other high-level functional language or OODL, like Dylan), which they use for their intro to programming courses at MIT--with the Abelson & Sussman text. You might also check out the text "Scheme and the Art of Programming" by Daniel P. Friedman & George Springer (MIT Press/McGraw Hill, 1989). Here you'll get a real taste of computer science, not be stuck dealing with the vagaries of low-level syntax (which is what you have to deal with in a language like C). -- J. Voigt / just some guy / not affiliated with anyone or anything (MediaLink@mail-newrock.coretech.com) +++++++++++++++++++++++++++ >From clyde@hitech.com.au (Clyde Smith-Stubbs) Date: Mon, 01 Jan 1996 23:09:25 GMT Organization: HI-TECH Software On 31 Dec 1995 03:27:31 GMT, dallas@az.com (Brad & Angie) wrote: >Pascal or C++? >So what is the answer? >I am starting a new programming class at the high school level this >January and don't have a compiler yet. We also don't have much money! Does I personally feel that with a good compiler - one that is fussy about possible errors - teaching C at the high-school level is not a problem. Certainly don't try C++. Pascal is OK, but gets frustrating for anything beyond a simple level. For a cheap compiler, download Pacific C from the URL below - for use in your programming class it's free, and your students can take a copy home too. The user interface is ideal for novice programmers, and the error messages are second to none. Happy New Year! Clyde Smith-Stubbs | HI-TECH Software, | Voice: +61 7 3300 5011 clyde@hitech.com.au | P.O. Box 103, Alderley, | Fax: +61 7 3300 5246 http://www.hitech.com.au | QLD, 4051, AUSTRALIA. | BBS: +61 7 3300 5235 - -------------------------------------------------------------------------- FREE! Download our shareware (FREE for noncommercial use) MS-DOS C Compiler! Point your Web browser at http://www.hitech.com.au/ +++++++++++++++++++++++++++ >From pascal@gonzo.wolfenet.com (Jeff Roegner) Date: 2 Jan 1996 05:55:44 GMT Organization: Wolfe Internet Access, L.L.C. As a student who has been in high school and has studied Pascal in the A.P. program and is now studying C/C++ under the same program, I can honestly say that I recommend Pascal as a language to concider if you are creating a computer science curriculum. Reasons for Pascal in your curriculum: 1: Easy to learn/understand 2: Teaches good habits 3: Still/actually used - unlike Hypercard, logo, basic, etc., Pascal is actually used 4: Good college prep - think how many colleges teach Pascal in their Comp. sci 101 classes - every small, private liberal arts college I looked at still taught Pascal, and having that knowledge before going into college is going to put me ahead in the long run 5: Easy tranfer to C/C++ - let's face it,Pascal and C are exactly alike, only the syntax changes, it is only in C++ where the differences evolve, so once you have the foundation in Pascal,you can then easily change to C and thus will have twice the knowledge by knowing both languages Reasons against Pascal: 1: The A.P. test will be in C/C++ starting in 1999. 2: Pascal is not the "language of choice"like it perhaps once was and is not as used in the industry as C/C++ A way to solve the problem for your school may be to teach a "intro to comp. sci" class with Pascal and then an "A.P. Computer Sci." class with C/C++. We have a similar curriculum with Basic in the intro class and Pascal in the A.P. class. We also then have about 6 people in a second year A.P. class who are taking C/C++ In high school, I feel it is important to get a grasp of what computer science is all about through the learning of a language, but just learning a language isn't really enough to do any hard core programming, that's why you go to college and extend upon those basics you learned in high school. Pascal is a great foundation, as I am finding as I work on C/C++. The bottow line is that so few students in high school are going to be doing any major work, that even if you taught them C/C++, what good would it do? The key is in planting the foundation for later learning. +++++++++++++++++++++++++++ >From zcemm23@ucl.ac.uk (Guy Ruth Hammond) Date: Tue, 2 Jan 1996 13:12:21 GMT Organization: Bloomsbury Computing Consortium In article <dallas-3012950728570001@ppp31.atlantica.net> dallas@az.com (Brad & Angie) writes: >Pascal or C++? >So what is the answer? Pascal is a good language for learning - it was my first compiled language. But it's not used much in industry, there you have C, C++, FORTRAN and COBOL (the last two being maintaince of legacy code) and various niche systems like VB and Java. C is harder to learn than pascal, but when you have learnt it, it's almost instinctive to use. I'm just learning C++ now, doing design projects in it and things are going swimmingly. If you get the academic discount, CW is a lot cheaper! >Brad & Angie Dallas >dallas@az.com * Guy Ruth Hammond - The Vampire Uustat * * Undergraduate at University College London, Mechanical Engineering * * hammond_g@meng.ucl.ac.uk | http://www.ucl.ac.uk/~zcemm23/home.html * * Though I walk through the valley of death I shall fear no evil * +++++++++++++++++++++++++++ >From sean@corf.demon.co.uk (Sean A Corfield) Date: Tue, 02 Jan 1996 15:08:40 +0000 Organization: OCS In article <1996Jan2.131221.13895@ucl.ac.uk>, zcemm23@ucl.ac.uk (Guy Ruth Hammond) wrote: |> Pascal is a good language for learning - it was my first compiled language. Likewise...almost. I learnt Algol 60 first (briefly) then BASIC then Pascal. Once I started work (over 10 years ago :-) I picked up C easily given the grounding in Pascal. For the last four years I've been working almost exclusively with C++ and have been involved with the standards process too. |> C is harder to learn than pascal, but when you have learnt it, it's almost |> instinctive to use. C is also harder to teach if you want students to avoid many of its pitfalls. C++ is an order of magnitude harder to teach, and learn, because there is a great deal more to absorb in the way of design issues (and any course that does not deal with those issues is a failure). The CodeWarrior package would be good for Brad & Angie since it provides Pascal, C and C++ and the academic price is a bargain. Funnily enough, my career (in compiler writing and related jobs) has mirrored the progression above: I started writing optimisers for Pascal compilers, then worked on a C to Pascal translator (hard: think about pointers), then began working on C (and COBOL) compilers -- including the first ANSI-validated C compiler. Since then there's been a lot of C++. It's a reasonable learning curve spread over a long period of hard experience. College courses have a long way to go before they satisfy the needs of industry in this area because they often focus on a language instead of on problem solving skills and programming per se. Things are definitely improving though (from what I see in my role as an external examiner on computing courses). [sorry, I'm getting a bit off-topic, aren't I?] Sean A Corfield Object Consultancy Services C++ - Beyond the ARM - http://uptown.turnpike.net/~scorf/cplusext.html +++++++++++++++++++++++++++ >From surgsw@mizzou1.missouri.edu (Joel Weinstein) Date: Thu, 04 Jan 1996 20:40:10 -0700 Organization: University of Missouri - Columbia I recommend codewarrior academic, unless of course, your high school students are planning to make Doom 3, heh heh. No need to send this to so many newsgroups. One would get you an answer. +++++++++++++++++++++++++++ >From user@portal.dx.net (jeremyj) Date: 4 Jan 1996 23:08:53 -0500 Organization: DataXchange Network >I'm 14 and starting to learn C. High school is definately not too >early. I'm 16 years old. I lave taught myself C, C++, Assembler, BASIC, Pascal, UNIX ShellScript, LISP, and a little FORTRAN. Personally, I prefer Pascal or C, due to their compatibilty, support, and respective ease of use. For a high school course, shoot for Pascal or C; Stay away from BASIC, and run from HyperCard; it's more of a toy to most high level programmers (for you HyperCard users, don't get all angry at me. I use HyperCard, even written at least a dozen elaborate stacks for it, but you can't exactly rewrite a copy of X-Wing or remake Stratavision 3d with it). To me, knowing Pascal well has made it easier to learn the other languages, so I'd say that's you're best bet. Go with Codewarrior; If you decide to keep with the times, you can move the class to C or C++ in the future. JRJ jrj@ring.com Please mail me comments. +++++++++++++++++++++++++++ >From <bonnardv@pratique.fr> Date: 7 Jan 1996 18:43:27 GMT Organization: Internet Way jj10s@eworld.com (J. Voigt) wrote: >In article <dallas-3012950728570001@ppp31.atlantica.net>, dallas@az.com >(Brad & Angie) wrote: > >> Pascal or C++? >> So what is the answer? .. >For entry level programming, I'd recommend one of the following: >Logo, Basic, or HyperCard.d > What's a good language to learn programming ? People who learn programming want to take care of the algorithm, not of the syntax or of the implementation. It seem obvious for me that if they want to learn programming *seriously* (not only to write 20-lines programs in Basic) they need a structured language who support sub-programs (or procedures or functions). The 'standard' Basic (the Basic instructions compatibles with most implementations of Basic) doesn't support sub-programs; I know two syntax for sub-programs in Basic, incompatibles with each-other ! That's the problem with Basic (and some other languages of the same kind): lots of incompatibilities, most books/examples have a specific (and not Macintosh) syntax (even if they express simple things). I believe that it is far easier to write a program (portable or not) longer then 100 lines in Pascal or C then in Basic. For all these reasons, I think that languages able to express algorithms with a natural syntax are Pascal, C, C++, Ada... The problem with Pascal is that the ISO standard has disappeared under the TurboPascal standard. In my opinion, C is the best choice because it is portable, it has a good ANSI library, it has type-checking, and C programs can easily be converted to C++ (an Object Oriented Pascal exists, but C++ is really better). Valentin Bonnard bonnardv@pratique.fr +++++++++++++++++++++++++++ >From jhalmen@news.abo.fi (Johan Halmen UPR) Date: 8 Jan 1996 00:36:15 GMT Organization: Abo Akademi University bonnardv@pratique.fr wrote: : What's a good language to learn programming ? : In my opinion, C is the best choice because it is portable, it has a : good ANSI library, it has type-checking, and C programs can easily be : converted to C++ (an Object Oriented Pascal exists, but C++ is really : better). If one starts learning programming from scratch¸ I believe Pascal is better than C. It is originally developed for teaching programming¸ C was developed for professional programmers to develope the Unix system. I don't say that C is a bad choice¸ only that it's next to best. If you don't have the slightest idea of what programming is¸ choose Pascal¸ otherwise C. Johan Halmen +++++++++++++++++++++++++++ >From andy@ldd.net (Andrew Engle) Date: 8 Jan 1996 04:57:46 GMT Organization: Southeast Missouri State University In article <4cpotv$op9@josie.abo.fi>, jhalmen@news.abo.fi says... >If one starts learning programming from scratch¸ I believe Pascal >is better than C. It is originally developed for teaching >programming¸ C was developed for professional programmers to >develope the Unix system. I don't say that C is a bad choice¸ >only that it's next to best. If you don't have the slightest >idea of what programming is¸ choose Pascal¸ otherwise C. > >Johan Halmen Curious that you should make such a post! In about a week, I will begin my first university course that deals with C. Specifically the course is titled "C and the Unix Environment". While I'm not exceedingly concerned about the Unix portion of the curriculum, the C concerns me. All my prior Computer Science courses dealt strictly with Pascal (Turbo, to be precise, including the OOP extensions). My question to you and any others who may be kind enough to lend a word of advice is what types of pitfalls and other curious things should I be wary of and/or lend additional scrutiny to in my transition from Pascal to C? Thank you very much in advance for anything you might send my way. Andrew Engle +++++++++++++++++++++++++++ >From stacys@isis.interpac.net (Stacy Sherman) Date: 8 Jan 1996 06:14:11 GMT Organization: Inter-Pacific Networks C should never be used as a first programming language, especially at high school level. I got my CS degree in '91 and they were teaching most of the courses in Pascal and were just starting to use C. Even now, the first few courses are still taught in Pascal. You want to teach them HOW to program. Not how to program in C. It's really easy to screw up & get frustrated in C. Plus, C relies heavily on pointers which are a difficult concept for many people. CodeWarrior academic might be a good choice, or the codewarrior starter kit. They have both C and Pascal built in. Just because it can't generate PPC code doesn't mean it can't be used on the PowerMac. You can run the compiler on the PowerMac and any programs you create with them. The programs won't be native, that's all. Stacy +++++++++++++++++++++++++++ >From waldo@buffnet.net (Kevin Eye) Date: Mon, 08 Jan 1996 20:38:24 -0500 Organization: BuffNET >: What's a good language to learn programming ? I'd have to say Think Pascal is good to learn and about the quickest to throw together programs in (of the high level languages/compilers). Don't use HyperCard ( It's great and a real advantage of a mac, but it won't get you anywhere.) or BASIC. If you learn Pascal, C is simple to learn and vice versa, but Think Pascal automates a lot of the tricky compiling stuff, but the language is the same. Maybe I'm biased because I only recently got C with CodeWarrior but I still like the Think Pascal environment better, especially for beginning. +++++++++++++++++++++++++++ >From gilmoure@mailhost.acc.net (Glenn) Date: 10 Jan 1996 00:28:32 GMT Organization: acc.net Orlando Hi! This is in similar vein. I am in an intro Pascal course at college. They use Turbo 7 Pascal for pcs and finished assignments have to run in dos. Anyone know of a mac compilar that will spit out dos stuff? CW, perhaps? The box didn't mention anything about that. TIA, glenn -- Gilmoure of Trimaris '70 Triumph chopper (project) **Think about it, Murray. ... If we could get this baby runnin', we could run over hikers, pick up females, chase down mule deer-man, we'd be the grizzelies from hell.** G.Larson +++++++++++++++++++++++++++ >From Valentin Bonnard <bonnardv@pratique.fr> Date: 10 Jan 1996 12:31:53 GMT Organization: Internet Way waldo@buffnet.net (Kevin Eye) wrote: >>: What's a good language to learn programming ? > >I'd have to say Think Pascal is good to learn and about the quickest to >throw together programs in (of the high level languages/compilers). Don't >use HyperCard ( It's great and a real advantage of a mac, but it won't get >you anywhere.) or BASIC. If you learn Pascal, C is simple to learn and >vice versa, but Think Pascal automates a lot of the tricky compiling >stuff, but the language is the same. Maybe I'm biased because I only >recently got C with CodeWarrior but I still like the Think Pascal >environment better, especially for beginning. I have used Think Pascal and Turbo Pascal for DOS at the same time and tried to run the same programs; the problem with Think Pascal= is the number of incompatibilities with Turbo Pascal, one example: procedure foo; ... exit (Foo); { Think, not Turbo } procedure foo; ... exit; { Turbo, not Think } (But if you wanted to have some compatibility between platforms, you would *not* have chosen Pascal.) I had problems in Think Pascal with the editor too: sometimes, when you make a syntax fault, the editor prevents you from correcting= it. Valentin Bonnard bonnardv@pratique.fr +++++++++++++++++++++++++++ >From Valentin Bonnard <bonnardv@pratique.fr> Date: 11 Jan 1996 01:05:31 GMT Organization: Internet Way andy@ldd.net (Andrew Engle) wrote: >My question to you and any others who may be kind enough to lend a word of >advice is what types of pitfalls and other curious things should I be wary of >and/or lend additional scrutiny to in my transition from Pascal to C? To understand the following, you should first learn the basic keywords and syntax for functions, blocks... I will only point-out the not-so-obvious differences... MY notations: <=> mean is equivalent to -> mean the Pascal code ... In addition to the fact that BEGIN gives { and that there are no DO there are significant differences between Pascal and C. First of all: * for if else do while return break typedef int short float double... are *reserved* keywords (cannot be used for another thing); no= predefined that can be changed (like WriteLn, ReadChar...). * the capitalisation is significant ('For' can be a variable name, but 'for' can only be used for "for (i=1; i<2; i=i+1) or for (i=1= ; i<2; i++) since i++ signifies i=i+1". The Integers Types ================== CHAR (8 bits) char (sometimes signed, sometimes unsigned, write 'unsigned char' to be sure) INTEGER (16 bits) short = short int, *not int* int (16 or 32 bits, natural word) LONGINT (32 bits) long = long int char is just an integer type, like any others. --------------- The Boolean Type, Some Logic ============================ The BOOLEANs are replaced by int (or Boolean on the Mac, or Bool on PC, each of them defined as int, or short int); TRUE if <> 0, FA= LSE if = 0, thus IF a THEN /* a being a BOOLEAN */ -> if (a) /* a being of any integer type or a pointer to what you want */ <=> if (a != 0) /* != mean <> */ IF NOT a THEN -> if (!a) /* NOT -> ! */ <=> if (a != 0) /* != mean <> */ TRUE is defined as the integer 1, FALSE as 0 IF a = FALSE -> if (a == FALSE) <=> if (! a) Logical operators ================= and (resp. or) operators are &&,& (||,|) if (a && b) if-block else else-block <=> if (a) if (b) if-block else else-block For && and ||, the second operand is evaluated only if the first doesn't tell the answer (if a is true, that is to say <> 0, a || b = is true. As a beginner, you should not write that: (well, I do) if (a && DoSomethingAndReturnResult) /* because DoSomethingAndReturnResult is executed only if a is true, which is unclear */ On the contrary, & and | are bit-wise operators (and ^ is the bit-wise XOR), and the two operands are *always* evaluated. In TurboPascal, the distinction exists as a flag {S+} or something like that... In Think Pascal this flag doesn't work. So there is = an ambiguity in Pascal that don't exist in C. Some operators ============== First, don't forget: {Pascal} a := b; -> a = b; {Pascal} a = b; -> a == b; {Pascal} a <> b; -> a != b; You can write: a = b; a += b; <=> a = a + b; a -= b; <=> a = a - b; a *= b; <=> a = a * b; a /= b; <=> a = a / b; /* for float (Pascal /) and integer (Pascal DIV) */ a %= b; <=> a = a % b; /* MOD */ a &= b; <=> a = a & b; /* bit-wise */ a |= b; <=> a = a | b; /* bit-wise */ a ^= b; <=> a = a ^ b; /* bit-wise */ ++a; <=> a += 1; <=> a = a + 1; --a; <=> a -= 1; <=> a = a - 1; where a is a left-value (something that can be assigned) and b a value A left-value is: - a variable, member of struct (RECORD), union (RECORD CASE OF), array... - *addr, where addr is a value ALL of them return the value of 'a' after the computation except a++ and a-- which return the value before the incrementation/decrem= entation. Functions and Procedures ======================== There is no difference between functions and procedures: A procedure is a function that return void (void mean nothing); a statement is simply a expression. These are legal: 3; 4+5; a+b+5; /* given a and b are defined */ a = b = 3; <=> a = (b = 3); <=> b = 3; a = b; char ReadKey (void); char ReadKey () { char key; ...... return key; } char c; c = ReadKey (); /* the return value is used */ ReadKey (); /* this is legal: the return value is not used */ Note ==== I have wrote here some explanations about what seem to be important for the C beginner; I have forgotten lots of things. Valentin Bonnard bonnardv@pratique.fr +++++++++++++++++++++++++++ >From gilmoure@mailhost.acc.net (Glenn) Date: 10 Jan 1996 00:28:32 GMT Organization: acc.net Orlando Hi! This is in similar vein. I am in an intro Pascal course at college. They use Turbo 7 Pascal for pcs and finished assignments have to run in dos. Anyone know of a mac compilar that will spit out dos stuff? CW, perhaps? The box didn't mention anything about that. TIA, glenn -- Gilmoure of Trimaris '70 Triumph chopper (project) **Think about it, Murray. ... If we could get this baby runnin', we could run over hikers, pick up females, chase down mule deer-man, we'd be the grizzelies from hell.** G.Larson +++++++++++++++++++++++++++ >From skershaw@scu.edu.au (Shane Kershaw) Date: Sat, 13 Jan 1996 11:39:32 +1100 Organization: Virtual Studios, Faculty of Arts, Southern Cross University In article <4cqcnj$387@pegasus.interpac.net>, stacys@isis.interpac.net (Stacy Sherman) wrote: >C should never be used as a first programming language, especially at >high school level. I got my CS degree in '91 and they were teaching most >of the courses in Pascal and were just starting to use C. Even now, the >first few courses are still taught in Pascal. I agree with you here Stacy (where did you do your degree?). Our Uni has just changed all of its coding courses and removed Pascal from the curriculum entirely. Tis worriesme, especially as they included Visual Basic as an example of RAD environemnt (not, I would have thought:-). > You want to teach them HOW to program. Not how to program in C. It's > really easy to screw up & get frustrated in C. Plus, C relies heavily on > pointers which are a difficult concept for many people. Again I agree. I stil lthe think that best approach that can be applied here is to use the good old pencil and paper compiler for the first semester course - don't let them near a machine until they can express their intentions algorithmically, this will ultimately lead to better code and results for the students, because they won;t be fighting the have-I-got-the-right-algorithm battle whilst trying to learn the syntax and smemantics of whatever language they are using. One of the best things I liked about my degree was that I was able to do a comparative study of languages in the same semester I had to do the cobol unit - C, Pascal, Modula2, Cobol and hypertalk (v1.2.5). In some cases what was required in the cobol unit algorithmically was also required in the comp lang unit, so I was abler to see that the algorithm didn't change, but the implementation of the algorithm might, i.e. two lines of code in c, maybe 3 in pascal (no ternary if statement) and 6 lines in cobol. It was an eye opener and has made me an advocate of algorithm first, implementation second approach to coding. > CodeWarrior academic might be a good choice, or the codewarrior starter > kit. They have both C and Pascal built in. Just because it can't > generate PPC code doesn't mean it can't be used on the PowerMac. You can > run the compiler on the PowerMac and any programs you create with them. > The programs won't be native, that's all. Uum, I wansn't aware that this was the case - I use CW academic and don't have any problem generating PPC only code. The only limitation of CW academic is that you can't sell your programs - no more, no less. Shane -- Shane Kershaw Co-moderator of sci.psychology.research Systems Administration, Virtual Studios Southern Cross University, NSW Australia +++++++++++++++++++++++++++ >From tblancha@evolving.com (Todd Blanchard) Date: 23 Jan 1996 00:26:52 GMT Organization: Evolving Systems, Inc. Shane Kershaw (skershaw@scu.edu.au) wrote: : In article <4cqcnj$387@pegasus.interpac.net>, stacys@isis.interpac.net : (Stacy Sherman) wrote: : >C should never be used as a first programming language, especially at : >high school level. I got my CS degree in '91 and they were teaching most : >of the courses in Pascal and were just starting to use C. Even now, the : >first few courses are still taught in Pascal. Well, I teach CS at Univ of Colorado Denver and we've started to do our data structures class using C++. Its more strongly typed than C so its a bit safer to learn with. RE: Pointers are difficult - yes they are, but all truly powerful concepts are. For teaching algorithms, it is hard to beat C. - --------------------------------------------------------------------- Todd Blanchard tblancha@evolving.com Evolving Systems Inc. VOX: (303) 689-1798 FAX: (303) 689-1399 When the only hammer you have is C++, the whole world looks like a thumb. - --------------------------------------------------------------------- +++++++++++++++++++++++++++ >From jeisenstein@wesleyan.edu (Jacob Eisenstein) Date: Sat, 27 Jan 1996 14:38:04 -0500 Organization: Wesleyan University In article <waldo-0801962038240001@dppp21.buffnet.net>, waldo@buffnet.net (Kevin Eye) wrote: > >: What's a good language to learn programming ? > > I'd have to say Think Pascal is good to learn and about the quickest to > throw together programs in (of the high level languages/compilers). Don't Actually, I've just begun to learn both Pascal and C++ in the last month, and I think they're of about equal difficulty. That said, I'd favor C++ simply from the standpoint of how often you will want to use it in the future. > Don't use HyperCard ( It's great and a real advantage of a mac, but it won't > get you anywhere.) or BASIC. My preference is a lisp variant, Scheme. For Mac, get MacGambit. Scheme teaches good programming habits, and a lot of important basic concepts. Scheme will help you write good solid programs in other languages. Biggest disadvantage: it isn't used for anything besides teaching computer science. So if you want to be using a marketable language immediately, C++ is your best bet. -jacob --------------------------- >From matsrc@hofstra.edu (Steven R. Costenoble) Subject: PixMap pmVersion field Date: Thu, 18 Jan 1996 16:30:18 -0500 Organization: Hofstra University Does anyone know what the possible values are of the pmVersion field of a PixMap, and what they mean? I just ran into a nasty problem that froze a IIci running 7.1 badly (mouse frozen, can't break into MacsBug with the programmer's button). I want to cache an image by CopyBitsing it into a PixMap that I allocate by hand. I call NewPixMap to create the PixMapHandle, allocate the storage myself and also reset the color table to the current port's table. NewPixMap copies most of the PixMap fields from the current port, including pmVersion, which is 2 (on the IIci running Sys 7.1). I do my drawing in an offscreen GWorld (created using NewGWorld). Then I try to CopyBits from the GWorld to the PixMap, and the computer freezes. After some investigation I notice that the pmVersion of the GWorld is 1 and of the PixMap is 2. Changing the pmVersion of the PixMap to 1 fixes the problem. Inside Macintosh is no help; it seems to say that the only possible values are 0 and 32. Also, the same code worked perfectly well on a PPC 7100 running MacOS 7.5.1, both as PPC code and as emulated 68K code (I haven't had a chance to go back and check the pmVersion fields there yet). Any ideas? --Steve Costenoble matsrc@hofstra.edu Dept. of Mathematics Hofstra University +++++++++++++++++++++++++++ >From cameron_esfahani@powertalk.apple.com (Cameron Esfahani) Date: Tue, 23 Jan 1996 02:08:36 -0800 Organization: Apple Computer, Inc. The current port when you called NewPixMap must have been a GWorld. The pmVersion is used by Quickdraw to store some state. If the pmVersion field is 1, that means the baseAddr field is a pointer to the data. If the pmVersion field is 2, that means the baseAddr field is a handle to the data. Since you have put a pointer into the baseAddr field, if the pmVersion is 2, Quickdraw will try to double dereference your baseAddr and crash. When you call NewPixMap, make sure a GWorld is not the current port. Cameron Esfahani +++++++++++++++++++++++++++ >From njaharve@undergrad.math.uwaterloo.ca (Nick Frosh) Date: Thu, 25 Jan 1996 23:49:37 GMT Organization: University of Waterloo In article <cameron_esfahani-2301960208360001@17.202.33.245>, Cameron Esfahani <cameron_esfahani@powertalk.apple.com> wrote: >The pmVersion is used by Quickdraw to store some state. If the pmVersion >field is 1, that means the baseAddr field is a pointer to the data. If >the pmVersion field is 2, that means the baseAddr field is a handle to the >data. Is this documented? Are we supposed to use this technique, or should we not be fiddling around with the private QuickDraw variables? Thanks, Nick -- ------- /----------------------------------------------------------- ( __ __ ) --\ | nick.harvey@pobox.com \\_) (_// | | http://calum.uwaterloo.ca/u/njaharve/ \ " / | +++++++++++++++++++++++++++ >From cameron_esfahani@powertalk.apple.com (Cameron Esfahani) Date: Tue, 30 Jan 1996 02:55:49 -0800 Organization: Apple Computer, Inc. Jesus Christ, no! Call LockPixels and UnlockPixels. Cameron Esfahani --------------------------- >From fettig@cloister (Thomas Fettig) Subject: TextEdit: how to stay in one line? Date: 25 Jan 1996 15:57:39 GMT Organization: DFKI - German Research Center for Artificial Intelligence Hi, it seems that the TextEdit-Routines have no special mode to keep the text in one line and scroll the characters horizontally. Am right with this observation? How do i prevent the destination rectangle from growing to the bottom? I.e which hooks are to set? I'm sure many programmers have solved this problem, so perhaps there is source-code anywhere? tom +++++++++++++++++++++++++++ >From jayfar@netaxs.com (Jay Farrell) Date: Thu, 25 Jan 1996 12:04:14 -0500 Organization: Jayfar's Web In article <FETTIG.96Jan25165739@cloister>, fettig@cl.dfki.uni-sb.de wrote: | Hi, | | it seems that the TextEdit-Routines have no special mode | to keep the text in one line and scroll the characters horizontally. | Am right with this observation? How do i prevent the destination | rectangle from growing to the bottom? I.e which hooks are to set? | I'm sure many programmers have solved this problem, so perhaps | there is source-code anywhere? Put a negative value in the CRonly field of your TE record. Cheers, Jayfar ////~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//// //// The Mops Page <URL:http://www.netaxs.com/~jayfar/mops.html> //// ////~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//// //// Mops is Mike Hore's freeware Forth/Smalltalk hybrid for Macintosh //// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Jay Farrell jayfar@netaxs.com Philadelphia, Pennsylvania, USA +++++++++++++++++++++++++++ >From fettig@cloister (Thomas Fettig) Date: 25 Jan 1996 22:39:51 GMT Organization: DFKI - German Research Center for Artificial Intelligence thanks to jayfar@netaxs.com (Jay Farrell) for the answer: >Put a negative value in the CRonly field of your TE record. perhaps this thread should be in the next csmp-digest? tom +++++++++++++++++++++++++++ >From pottier@drakkar.ens.fr (Francois Pottier) Date: 26 Jan 1996 10:44:33 GMT Organization: Ecole Normale Superieure, Paris In article <FETTIG.96Jan25233951@cloister>, Thomas Fettig <fettig@cl.dfki.uni-sb.de> wrote: >perhaps this thread should be in the next csmp-digest? Don't worry, Big Brother is watching you. -- Francois pottier@dmi.ens.fr http://www.eleves.ens.fr:8080/home/pottier/ --------------------------- >From dubois@night.primate.wisc.edu (Paul DuBois) Subject: TransSkel 3.24 is available (CW 8 support added) Date: 25 Jan 1996 15:45:38 -0600 Organization: UW-Madison Primate Center Release 3.24 of TransSkel, a skeleton for Macintosh application development under MetroWerks C or Pascal or Symantec C++/THINK C, is now available. This is an update release; the Metrowerks projects have been updated to compile under CodeWarrior 8. Otherwise it's identical to release 3.23. The documentation is available separately, in either Word 6 or RTF format. TransSkel is available via any of the following: WWW using URL http://www.primate.wisc.edu/software/mac/TransSkel/ anonymous ftp to ftp.primate.wisc.edu (under /pub/mac/TransSkel) gopher to gopher.primate.wisc.edu, then select "Primate Center Software Archives") -- Paul DuBois dubois@primate.wisc.edu Home page: http://www.primate.wisc.edu/people/dubois Software: http://www.primate.wisc.edu/software +++++++++++++++++++++++++++ >From pcastine@prz.tu-berlin.de (Peter Castine) Date: Fri, 26 Jan 1996 15:50:09 +0100 Organization: Process Control Center, TU Berlin In article <4e8tm2$hr9@night.primate.wisc.edu>, dubois@night.primate.wisc.edu (Paul DuBois) wrote: >TransSkel is available via any of the following: > >WWW using URL http://www.primate.wisc.edu/software/mac/TransSkel/ > >anonymous ftp to ftp.primate.wisc.edu (under /pub/mac/TransSkel) Any mirror sites, maybe east of the Atlantic Ocean? Right now FTP is getting me about 20 bytes/s over from Wisconsin, I think I'm gonna have to kill the connection. Thanks, Peter - -------- For a good time, http://www.prz.tu-berlin.de/~pcastine --------- Dr. Peter Castine | Whenever I hear anyone arguing for slavery, I pcastine@prz.tu-berlin.de | feel a strong impulse to see it tried on him Process Control Center | personally. Technical University Berlin | -- Abraham Lincoln --------------------------- >From verec@micronet.fr (Jean-Francois Brouillet) Subject: WorldScript, UniCode & Cross-Platform ? Date: Fri, 26 Jan 1996 16:25:25 +0100 Organization: Francenet -- Paris, France Hi all! I'm writing a Macintosh app which is to share its files with its Windows's counterpart beeing written now. Among the data we have to share, we have user entered text. As far as I get a complete picture, I don't seem to see a way we could get both cross-platform AND international support : WorldScript supports a mixture of 1-byte & 2-byte codes. WorldScript doesn't support UniCode yet. Windows95/Windows NT supports both 1 & 2 bytes characters (Mac incompatible) mixture plus UniCode (Windows95 doesn't directly support UniCode, but has ways to translate back and forth between its native format and UniCode). My best bet seem to be to go with UniCode, as its support is announced for Copland, but in the meantime I need ways to convert back and forth between WorldScript multi-byte encoding and UniCode. Anyone has already done similar things ? Any pointer ? Where can I find the complete UniCode Specs ? -- Jean-Francois Brouillet verec@micronet.fr Macintosh Software Developer verecundus@eworld.com +++++++++++++++++++++++++++ >From kris@hawkins.ecn.purdue.edu (Kris L Jorgensen) Date: 26 Jan 1996 16:45:37 GMT Organization: Purdue University, W. Lafayette, IN Jean-Francois Brouillet (verec@micronet.fr) wrote: > Hi all! > I'm writing a Macintosh app which is to share its files with its Windows's > counterpart beeing written now. Among the data we have to share, we have > user entered text. > As far as I get a complete picture, I don't seem to see a way we could get > both cross-platform AND international support : > WorldScript supports a mixture of 1-byte & 2-byte codes. > WorldScript doesn't support UniCode yet. > Windows95/Windows NT supports both 1 & 2 bytes characters (Mac > incompatible) mixture plus UniCode (Windows95 doesn't directly support > UniCode, but has ways to translate back and forth between its native > format and UniCode). > My best bet seem to be to go with UniCode, as its support is announced for > Copland, but in the meantime I need ways to convert back and forth between > WorldScript multi-byte encoding and UniCode. > Anyone has already done similar things ? > Any pointer ? > Where can I find the complete UniCode Specs ? You might want to get the book "Understanding Japanese Information Processing" which describes how to do what you want. Ken Lunde, the author, has provided code to convert between the various different encoding methods used through out the world. You can get the code from <ftp://ftp.ora.com/pub/examples/nutshell/ujip/src/jconv.c>. Information about the book can be had from <http://www.ora.com/gnn/bus/ora/item/ujip.html>. You can even order the book from this site. I'm including the book information below. As far as Unicode is concerned try the Unicode home page at <http://www.stonehand.com/unicode.html>. I hope this helps. Understanding Japanese Information Processing By Ken Lunde 1st Edition September 1993 ISBN: 1-56592-043-0, Order Number: 0430 470 pages, $29.95 This book provides detailed information on all aspects of handling Japanese text on computer systems. It covers everything from the origins of modern-day Japanese to the latest information on specific emerging computer encoding standards. Appendices provide additional reference material: a code conversion table, character set tables, mapping tables, an extensive list of software sources, a glossary, and more. -- Kris L. Jorgensen Office: ME 183 Phone: (317) 494-8585 Email: kris@ecn.purdue.edu WWW: http://widget.ecn.purdue.edu/~kris +++++++++++++++++++++++++++ >From Peter De Mangelaere <pdmangel@eps.agfa.be> Date: Mon, 29 Jan 1996 09:50:22 +0000 Organization: Agfa-Gevaert N.V. See the "Unicode Convertor" folder on the "Mac TechSeed Jan '96" CD. There's documentation and dummy libraries (?) and an extension. I haven't looked deep into it yet. The complete UniCode Spec : The Unicode Standard - Worldwide Character Encoding Version 1.0, The Unicode Consortium, Addison - Wesley -- """ ___ _ <(o o)> | _ \___| |_ ___ _ _ +--------------oOO--(_)--OOo------------------+ | _/ -_) _| -_) '_| | Peter De Mangelaere, Agfa-Gevaert, Belgium | |_| \___|_| \___|_| | pdmangel@eps.agfa.be | +---------------------------------------------+ /\ /\ oOO OOo +++++++++++++++++++++++++++ >From dpolasch@apple.com (Dave Polaschek) Date: Wed, 31 Jan 1996 23:26:12 GMT Organization: Apple Computer, Inc In article <verec-2601961625250001@ppp104.micronet.fr>, verec@micronet.fr (Jean-Francois Brouillet) wrote: >Where can I find the complete UniCode Specs ? The Unicode home page is at <http://www.stonehand.com/unicode.html>. -- "Mr. Tick, can you destroy the Earth?" "Egads! I hope not! That's where I keep all my stuff!" Dave Polaschek - home:davep@eworld.com work:dpolasch@apple.com --------------------------- >From dnebing@epix.net (Dave Nebinger) Subject: [Ann] The alt.sources.mac WWW Archive Date: Tue, 30 Jan 1996 14:32:31 -0500 Organization: KHP Services, Inc The alt.sources.mac archive is now available on the world wide web. Point your browsers at: <http://www.AmbrosiaSW.com/alt.sources.mac/> Dave. ========================================================== Dave Nebinger dnebing@epix.net The Alt.Sources.Mac Archivist <http://www.AmbrosiaSW.com/alt.sources.mac/> <ftp://ftp.AmbrosiaSW.com/pub/alt.sources.mac/> --------------------------- >From gneufeld@ccs.carleton.ca (G. Neufeld) Subject: [src] Grant's CGI Framework beta 13 (mac C source) Date: Fri, 26 Jan 1996 10:53:50 GMT Organization: Carleton University Grant's CGI Framework Version 1.0 beta 13 <http://arpp.carleton.ca/grant/mac/grantscgi/> Grant's CGI Framework is a framework for writing 68K & PowerPC Macintosh CGI applications in C. The user of the framework only needs to modify one function (located in its own file) to produce a custom CGI - all the other details can be left to the framework. However, there are numerous options for customization available for those who need them. Macintosh programming experience is not required (although it helps) - but at least a basic knowledge of the ANSI C language is required. New in beta 13: * Easier menu customization * A number of new utility functions * Many bug fixes (some critical fixes) Features: * 68K and PowerPC native support * Multi-Threaded (thread support requires Apple's Thread Manager or System 7.5) * Automatic html form parsing with easy function access to individual fields * Supports Asynchronus CGI (ACGI) * Supports ListSTAR trigger and action events * AppleScriptable for testing without a server or MacTCP * Can optionally compile as faceless background-only application * Numerous configuration options for optimizing to your specific needs * Option for self-quitting after specified idle time * Significant performance increase over scripts such as those in AppleScript and Perl * Metrowerks and Symantec project files * If you use it to write free applications, it's free to use. Otherwise, there is a price. Download: <http://arpp.carleton.ca/grant/mac/grantscgi.sit.hqx> (b13 soon to be on the Info-Mac archives) Mailing List: To: grantcgi@arpp1.carleton.ca Subject: subscribe -- gneufeld@ccs.carleton.ca - grant@acm.org <http://arpp.carleton.ca/grant/> --------------------------- >From ghentsch@hookup.net (Georg Hentsch) Subject: calculating height of a text box Date: 21 Jan 1996 21:39:00 GMT Organization: Bannister Lake Software I need to calculate the height of a text box. Given the string, the font & the width of the box, how can I calculate the height of my text box? Is there 1 toolbox call or should I be using a combination of MeasureText & TextWidth? Regards, Georg -- Georg Hentsch, Bannister Lake Software ghentsch@hookup.net +++++++++++++++++++++++++++ >From heaney@crl.com (John S. Heaney) Date: 21 Jan 1996 16:32:58 -0800 Organization: CRL Dialup Internet Access (415) 705-6060 [Login: guest] In article <ghentsch-2101961635220001@ghentsch.wat.hookup.net>, Georg Hentsch <ghentsch@hookup.net> wrote: >I need to calculate the height of a text box. Given the string, the font & >the width of the box, how can I calculate the height of my text box? Is >there 1 toolbox call or should I be using a combination of MeasureText & >TextWidth? Just create a new TextEdit record with TENew or TEStylNew. Then call TEGetHeight, which takes the first and last line of interest to you. I'm pretty sure these values are zero based, so you would want to use 0 for the start line and TERec.nLines-1 for the end line. There is something weird about having a CR as the last character of your text. Apparently, it underestimates the number of lines by one in this case. Here's the pertinent C code from an old Think C project: /****************************************************************************** GetNumLines Return the number of lines of text. ******************************************************************************/ long CEditText::GetNumLines( void) { long numLines = (**macTE).nLines; long teLen = (**macTE).teLength; /* TE line count is not correct if */ /* last char is a carriage return */ if ((teLen > 0) && ((*(**macTE).hText)[ teLen - 1] == CARRIAGE_RETURN)) numLines++; return numLines; } /****************************************************************************** GetHeight Return the height in pixels of the indicated lines of text. ******************************************************************************/ long CEditText::GetHeight( long startLine, long endLine) { long height; height = TEGetHeight( endLine+1, startLine+1, macTE); return height; } This will be a snap to implement in Prograph. ;) Actually, I'll be doing that myself in the near future, so warn me if you have any problems. -- John Heaney Time flies whether you're having fun or not. heaney@crl.com +++++++++++++++++++++++++++ >From dbrosius@chesco.com (Dave Brosius) Date: 29 Jan 1996 05:18:23 GMT Organization: Chester County Internet Services, Inc. In article <ghentsch-2101961635220001@ghentsch.wat.hookup.net>, ghentsch@hookup.net (Georg Hentsch) wrote: > I need to calculate the height of a text box. Given the string, the font & > the width of the box, how can I calculate the height of my text box? Is > there 1 toolbox call or should I be using a combination of MeasureText & > TextWidth? > > Regards, Georg > > -- > Georg Hentsch, Bannister Lake Software > ghentsch@hookup.net GetFontInfo will return a fontinforec which has ascent, descent and leading for a font/size/style --------------------------- End of C.S.M.P. Digest **********************